

function say() {
    alert("559. N 叉树的最大深度;");
}
say();
/**
 * // Definition for a Node.
 * function Node(val,children) {
 *    this.val = val;
 *    this.children = children;
 * };
 */

/**
 * @param {Node} root
 * @return {number}
 */
var maxDepth = function(root) {
    //10:00-10:15   10:45-11:00
    if(!root){
        return 0
    }
  
    var children = root.children
    if(children.length == 0){
        return 1
    }

    var maxH = 0
    for(var i = 0; i < children.length; i++){
        var item = children[i]
        maxH = Math.max(maxH, maxDepth(item) + 1)
    }

    return maxH
};
